<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>财务管理</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width">
        <link href="//unpkg.com/layui@2.9.14/dist/css/layui.css" rel="stylesheet">
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <script src="./js/jquery.js"></script>
        <script src="./js/common/ajaxUse.js"></script>
        <script src="js/common/FilterExampleQuery.js"></script>
    </head>
    </head>

    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">物业财务管理</a>
                <a>
                    <cite>财务列表</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body FilterParent">
                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="submit('/search/exampleQuery',NotExampleQuery(6))">重置列表</i></button>
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="addFilter()">新增筛选</i></button>
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="submit('/search/exampleQuery',getExamples(6))">&#xe615;</i></button>
                            </div>

                            <div class="layui-collapse Filter" lay-filter="test">
                                <div class="layui-colla-item">
                                    <h2 class="layui-colla-title">条件筛选
                                        <i class="layui-icon layui-colla-icon"></i>
                                        <a title="删除" onclick="deleteFilter(this.parentElement.parentElement.parentElement)" href="javascript:;">
                                            <i class="layui-icon">&#xe640;</i></a></h2>
                                    <div class="layui-colla-content">
                                        <form class="layui-form" action="">
                                            <div class="layui-form-item" id="tel" style="display: inline-block; margin-right: 10px;">
                                                <label for="fDate" class="layui-form-label">
                                                    交易日期
                                                </label>
                                                <div class="layui-input-inline">
                                                    <input type="date" id="fDate" name="fDate" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="fType" class="layui-form-label">
                                                    类型
                                                </label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="fType" name="fType" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="fStakeholder" class="layui-form-label">
                                                    相关人员/单位
                                                </label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="fStakeholder" name="fStakeholder" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="fStatus" class="layui-form-label">
                                                    状态
                                                </label>
                                                <div class="layui-input-inline" id="fStatus">
                                                    <select name="fStatus">
                                                        <option>未支付</option>
                                                        <option>未收入</option>
                                                        <option>收入</option>
                                                        <option>支出</option>
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="fStaffId" class="layui-form-label">
                                                    员工编号
                                                </label>
                                                <div class="layui-input-inline">
                                                    <input type="number" id="fStaffId" name="fStaffId" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="fAdminId" class="layui-form-label">
                                                    管理员编号
                                                </label>
                                                <div class="layui-input-inline">
                                                    <input type="number" id="fAdminId" name="fAdminId" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <div class="layui-input-block">
                                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                                </div>
                                            </div>
                                        </form>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div id="FilterDisplayContainer"></div>
                        <div class="layui-card-header">
                            <button class="layui-btn" onclick="xadmin.open('添加用户','finance-add.html',800,600)">
                                <i class="layui-icon"></i>
                                添加</button></div>
                        <div class="layui-card-table ">
                            <table class="layui-table layui-form data-list">
                              <thead>
                                <tr>
                                  <th><input type="checkbox" lay-filter="checkall" name="" lay-skin="primary"></th>
                                  <th >ID</th>
                                  <th >日期</th>
                                  <th >类型</th>
                                  <th>金额</th>
                                  <th>相关人员或单位</th>
                                  <th >设施ID</th>
                                  <th >状态</th>
                                  <th >员工编号</th>
                                    <th >备注</th>
                                  <th >操作</th>
                                </tr>
                              </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
            submit('/search/exampleQuery',NotExampleQuery(6))
            function doAction (data) {
                layer.open({
                    type: 2,
                    title: '修改数据', //ifrem的标题
                    maxmin: true, //最小化
                    shadeClose: true, //点击遮罩关闭层
                    area: ['80%', '80%'], //大小
                    content: 'finance-edit.html',//打开的url
                    success: function (layero, index) {
                        var body=layer.getChildFrame('body',index);
                        body.contents().find('#fId').val(data.childNodes.item(3).innerHTML);
                        body.contents().find('#fDate').val(data.childNodes.item(5).innerHTML);
                        body.contents().find('#fType').val(data.childNodes.item(7).innerHTML);
                        body.contents().find('#fAmount').val(data.childNodes.item(9).innerHTML);
                        body.contents().find('#fStakeholder').val(data.childNodes.item(11).innerHTML);
                        body.contents().find('#fNumber').val(data.childNodes.item(13).innerHTML);
                        if(data.childNodes.item(15).innerHTML === '未支付'){
                            select = 'dd[lay-value=\'0\']'
                        }else  if(data.childNodes.item(15).innerHTML === '未收入')
                        {
                            select = 'dd[lay-value=\'1\']'
                        }
                        else  if(data.childNodes.item(15).innerHTML === '收入')
                        {
                            select = 'dd[lay-value=\'2\']'
                        }else  if(data.childNodes.item(15).innerHTML === '支出')
                        {
                            select = 'dd[lay-value=\'3\']'
                        }
                        body.contents().find('#fStatus').siblings("div.layui-form-select").find('dl').find(select).click();
                        // body.contents().find('#fStatus').val(data.childNodes.item(15).innerHTML);
                        body.contents().find('#fStaffId').val(data.childNodes.item(17).innerHTML);
                        body.contents().find('#fNotes').val(data.childNodes.item(19).innerHTML);
                    }
                })
            }

          // 分类展开收起的分类的逻辑

            layui.use(['laydate', 'form'],
            function() {
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#start' //指定元素
                });
                //执行一个laydate实例
                laydate.render({
                    elem: '#end' //指定元素
                });
            });
            /*用户-删除*/
            function member_del(obj, id) {
                id = obj.parentElement.parentElement.childNodes.item(3).textContent;
                layer.confirm('确认要删除吗？',function(index){
                    submit("/Finance/deleteFinance",JSON.stringify({fId:id}))
                    //发异步删除数据
                    $(obj).parents("tr").remove();
                });
            }
        </script>

    </body>
</html>
